import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { InRecordVO, InRecordForm, InRecordQuery } from '@/api/credit/inRecord/types';

/**
 * 查询入账账单记录列表
 * @param query
 * @returns {*}
 */

export const listInRecord = (query?: InRecordQuery): AxiosPromise<InRecordVO[]> => {
  return request({
    url: '/credit/inRecord/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询入账账单记录详细
 * @param id
 */
export const getInRecord = (id: string | number): AxiosPromise<InRecordVO> => {
  return request({
    url: '/credit/inRecord/' + id,
    method: 'get'
  });
};

/**
 * 新增入账账单记录
 * @param data
 */
export const addInRecord = (data: InRecordForm) => {
  return request({
    url: '/credit/inRecord',
    method: 'post',
    data: data
  });
};

/**
 * 修改入账账单记录
 * @param data
 */
export const updateInRecord = (data: InRecordForm) => {
  return request({
    url: '/credit/inRecord',
    method: 'put',
    data: data
  });
};

/**
 * 删除入账账单记录
 * @param id
 */
export const delInRecord = (id: string | number | Array<string | number>) => {
  return request({
    url: '/credit/inRecord/' + id,
    method: 'delete'
  });
};
